<?php
	session_start(); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Login</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/login.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/form.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/button.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="../css/core.css" media="screen" />
    <!--[if IE 6]><link rel="stylesheet" href="../css/style.ie6.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="../css/style.ie7.css" type="text/css" media="screen" /><![endif]-->

</head>
<?php
	include("../process/database.php");
	include("../process/login.php"); 

	$user=new user();
	if(!empty($_POST['password']) && !empty($_POST['username']))
	{
		$username=$_POST['username'];
		$password=md5($_POST['password']);
		//echo $password;
		$tb_login = $user->login($username,$password);
		if(isset($_POST['submit-login']))
		{			
			if($tb_login == false)
			{
				echo "<script>alert('Login Fail!!!')</script>";
			}
			else 
			{
			
				echo '<meta http-equiv="refresh" content="1;url=index.php" />';
				$_SESSION['login_admin']='OK';
				$_SESSION['username_admin']= $tb_login['username'];
				$_SESSION['pass_admin']= $tb_login['password'];
			}		
		}
	}
?>

<body>
<div id="mws-login">
		    	<h1>Login</h1>
		        <div class="mws-login-lock"><img alt="" src="../images/locked-2.png" /></div>
		    	<div id="mws-login-form">
		       	<form method="post" class="mws-form" action="">
		                <div class="mws-form-row">
		                	<div class="mws-form-item large">
		                    	<input type="text" name="username" placeholder="username" class="mws-login-username mws-textinput" />
		                    </div>
		                </div>
		                <div class="mws-form-row">
		                	<div class="mws-form-item large">
		                    	<input type="password" name="password" placeholder="password" class="mws-login-password mws-textinput">
		                    </div>
		                </div>
		                <div class="mws-form-row">
		                	<input type="submit" class="mws-button green mws-login-button" name="submit-login" value="Login">
		                </div>
		            </form>
		        </div>
		    </div>

</body>
</html>




